﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace SF.Base.Core {
	[JsonObject(MemberSerialization.OptIn)]
	public class CommentEntity {
		/// <summary>
		/// 评论数字ID 自增列
		/// </summary>
		[JsonProperty(PropertyName = "cid")]
		public long CID {
			get;
			set;
		}
		/// <summary>
		/// 评论文本ID
		/// </summary>
		public string CommentId {
			get;
			set;
		}

		/// <summary>
		/// 评论对应的单词对象
		/// </summary>
		public DictEntity Dict {
			get;
			set;
		}
		/// <summary>
		/// 评论对应的单词拼写
		/// </summary>
		public string Spell{
			get;
			set;
		}

		/// <summary>
		/// 评论祖先数字ID
		/// </summary>
		public int OID {
			get;
			set;
		}

		/// <summary>
		/// 评论祖先文本ID
		/// </summary>
		public string ObjectId {
			get;
			set;
		}
		/// <summary>
		/// 评论祖先来源类型 dict sheet question voc
		/// </summary>
		public string ObjectType {
			get;
			set;
		}
		[JsonProperty(PropertyName = "name")]
		public string Author {
			get;
			set;
		}
		public string Email {
			get;
			set;
		}
		/// <summary>
		/// 头像
		/// </summary>
		[JsonProperty(PropertyName = "img")]
		public string Avatar {
			get;
			set;
		}
		public string IP {
			get;
			set;
		}
		[JsonProperty(PropertyName = "date")]
		[JsonConverter(typeof(DateTimeConverter))]
		public DateTime CommentDate {
			get;
			set;
		}
		/// <summary>
		/// 评论内容
		/// </summary>
		[JsonProperty(PropertyName = "content")]
		public string Content {
			get;
			set;
		}
		/// <summary>
		/// 评论类型
		/// </summary>
		public string CommentType {
			get;
			set;
		}
		/// <summary>
		/// 评论审核对象
		/// </summary>
		public int Approved {
			get;
			set;
		}
		/// <summary>
		/// 子节点个数
		/// </summary>
		[JsonProperty(PropertyName = "ccount")]
		public int ChildCount {
			get;
			set;
		}
		/// <summary>
		/// 评论状态
		/// </summary>
		public int Status {
			get;
			set;
		}
		/// <summary>
		/// 客户评论浏览器类型
		/// </summary>
		public string Agent {
			get;
			set;
		}

		/// <summary>
		/// 评论者数字ID
		/// </summary>
		[JsonProperty(PropertyName = "uid")]
		public long UID {
			get;
			set;
		}
		/// <summary>
		/// 评论者文本ID
		/// </summary>
		public string UserId {
			get;
			set;
		}
		/// <summary>
		/// 评论父节点文本ID
		/// </summary>
		public string ParentId {
			get;
			set;
		}

		public CommentEntity Parent
		{
			get;
			set;
		}
		/// <summary>
		/// 评论父节点数字ID
		/// </summary>
		[JsonProperty(PropertyName = "pid")]
		public long PID {
			get;
			set;
		}

		/// <summary>
		/// 重写ToString()方法
		/// </summary>
		/// <returns></returns>
		public override string ToString() {
			return "--------comment--------\r\nCOMMENT  :   " + Content + "";
		}
	}
}
